import Vue from 'vue'
import Router from 'vue-router'

Vue.use(Router)

/* Layout */
import Layout from '@/views/layout/Layout'
import { loginRoute, autoLoginRoute } from '@/views/login'
import { route as menumanage } from '@/views/menu'
import { route as personmanage } from '@/views/personmanage'
import { route as departmentmanage } from '@/views/departmentmanage'
import { route as usercheck } from '@/views/usercheck'
import { route as userDataCheck } from '@/views/userDataCheck'
import { route as dictmanage } from '@/views/dictmanage'
import { route as loggmanage } from '@/views/logmanage'
import { route as platformrole } from '@/views/platformrole'
import { route as datacenter } from '@/views/datacenter'
import { route as systemconfig } from '@/views/systemconfig'
import { route as roleuserallot, router as sysroleuserallot } from '@/views/roleuserallot'
import { tool } from '@/views/tool'
import { route as pageinfo } from '@/views/pageinfo'
import { route as config } from '@/views/config'
import { route as welfare } from '@/views/welfare'
import { route as skill } from '@/views/skill'
import { route as contentRepository } from '@/views/contentRepository'
import { route as information } from '@/views/information'
import { route as unionhome } from '@/views/unionhome'
import { route as staffserve } from '@/views/staffserve'
import { route as orgbuild } from '@/views/orgbuild'
import { route as activity } from '@/views/activity'
import { route as collectquestions } from '@/views/collectQuestions'  // 试题征集
import { route as innovationStudio } from '@/views/innovationStudio'  // 创新创效
import { route as dockingmanage } from '@/views/dockingmanage'
import { single, info } from '@/views/single'
import { route as datastatistics } from '@/views/datastatistics'
import pagemanage from '@/views/pagemanage/route'
export const constantRouterMap = [datacenter, loginRoute, autoLoginRoute, tool]
export default new Router({
  scrollBehavior: () => ({
    y: 0
  }),
  routes: constantRouterMap
})

export const asyncRouterMap = [
  {
    path: '/usermanage',
    component: Layout,
    redirect: '/usermanage/plateformuser',
    alwaysShow: true,
    meta: {
      title: 'usermanage',
      icon: 'user'
    },
    children: [departmentmanage, personmanage, single, info, usercheck, userDataCheck, roleuserallot]
  },
  unionhome,
  information,
  skill,
  contentRepository,
  staffserve,
  orgbuild,
  activity,
  collectquestions,
  innovationStudio,
  welfare,
  datastatistics,
  {
    path: '/sys',
    component: Layout,
    redirect: '/sys/sysconfig',
    alwaysShow: true,
    meta: {
      title: 'systemmanage',
      icon: 'sys'
    },
    children: [systemconfig, dictmanage, loggmanage, platformrole, sysroleuserallot, menumanage, pageinfo, dockingmanage]
  },
  config,
  pagemanage
]
